let compile = {
	compileStr: code => {
		let c = String.fromCharCode(code.charCodeAt(0) + code.length);
		for (let i = 1; i < code.length; i++) {
			c += String.fromCharCode(code.charCodeAt(i) + code.charCodeAt(i - 1));
		}
		return escape(c);
	},
	uncompileStr: code => {
		if (code === null || code === undefined) {
			return code;
		}
		code = unescape(code);
		let c = String.fromCharCode(code.charCodeAt(0) - code.length);
		for (let i = 1; i < code.length; i++) {
			c += String.fromCharCode(code.charCodeAt(i) - c.charCodeAt(i - 1));
		}
		return c;
	}
};

const install = function (Vue, options) {
	if (install.installed) return;
	Vue.prototype.$compile = compile;
};

if (typeof window !== 'undefined' && window.Vue) {
	install(window.Vue);
}

module.exports = {
	version: '1.0.0',
	install,
	compile: compile
};
